import React from 'react'
import ReactDOM from 'react-dom'

var Name = React.createClass({
    render: function () {
        return (
            <h1>{this.props.name}</h1>
        )
    }
})
var Link = React.createClass({
    render: function () {
        return (
            <a href={this.props.site}>
                {this.props.site}
            </a>
        )
    }
})

var WebSite = React.createClass({
    getInitialState: function(){
        return{
            name: 'baidu',
            site: 'http://www.baidu.com'
        }

    },
    render: function () {
        return(
            <div>
                <Name name={this.state.name}/>
                <Link site={this.state.site}/>
            </div>
        )
    }
})

ReactDOM.render(
    <WebSite/>,
    document.getElementById('app')
)